<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    request.setAttribute("basePath", basePath);
%>
<%@ include file="/resources/js/easyui/taglibs.jsp" %>
<%@ include file="/resources/js/wechat/_wechatui.jsp" %>
<%@ include file="/resources/js/easyui/_viewJS.jsp" %>
<!DOCTYPE>
<html>
<head>
    <title>账目详情</title>
</head>
<body>
<div class="loading"></div>
<!-- header -->
<header>
    <a href="javascript:history.go(-1);" class="top_fh">${statistic.placeName} ${statistic.deviceName}</a>
</header>
<!-- header end -->
<fmt:parseDate value="${statistic.statisticDate}" pattern="yyyy-MM-dd" var="queryDate"/>
<div class="page zmxq_page">
    <div class="zmxq_time">
        <%--<time id="GC_device_querydates" style="border:1px solid #0b3a58;"><fmt:formatDate value="${queryDate}" pattern="yyyy年MM月dd日"/></time>--%>
        <input id="GC_device_querydates" type="date" value="<fmt:formatDate value="${queryDate}" pattern="yyyy-MM-dd"/>">
        <a id="GC_device_thatday_details" href="javascript:void(0);"></a></div>
    <!-- 总收入 -->
    <div class="zmxq_allsr">
        <div class="zmxq_srlist">总收入<em>共计：${statistic.total}</em></div>
    </div>
    <!-- 总收入 end -->
    <div class="zmxq_money">
        <div class="zmxq_srlist">现金+硬币<em>总计：${statistic.billTotal+statistic.coinTotal}</em></div>
    </div>
    <!-- 现金 -->
    <div class="zmxq_xianjin">
        <div class="zmxq_srlist">现金<em>小计：${statistic.billTotal}</em></div>
        <div class="zmxj_inner">
            <ul>
                <li>
                    <div class="zmxj_left"><span>1</span>元<i>${statistic.oneBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.oneBalance * 1}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
                <li>
                    <div class="zmxj_left"><span>5</span>元<i>${statistic.fiveBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.fiveBalance * 5}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
                <li>
                    <div class="zmxj_left"><span>10</span>元<i>${statistic.tenBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.tenBalance * 10}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
                <li>
                    <div class="zmxj_left"><span>20</span>元<i>${statistic.twentyBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.twentyBalance * 20}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
                <li>
                    <div class="zmxj_left"><span>50</span>元<i>${statistic.fiftyBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.fiftyBalance * 50}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
                <li>
                    <div class="zmxj_left"><span>100</span>元<i>${statistic.hundredBalance}</i>张</div>
                    <div class="zmxj_right">￥<em><fmt:formatNumber value="${statistic.hundredBalance * 100}"
                                                                   pattern="#,###0.00"/></em></div>
                </li>
            </ul>
        </div>
    </div>
    <!-- 现金 end -->
    <!-- 一元硬币 -->
    <div class="zmxq_yiyuan">
        <div class="zmxq_srlist">一元硬币<em>小计：${statistic.coinTotal}</em></div>
    </div>
    <!-- 一元硬币 end -->
    <!-- 其他支付方式 -->
    <div class="zmxq_qitafs">
        <div class="zmxq_srlist">线上支付<em>总计：${statistic.noCashTotal}</em></div>
        <div class="zmqitaf_inner">
            <ul>
                <li>
                    <div class="zmxj_left">微信</div>
                    <div class="zmxj_right">￥<em>${statistic.wechatTotal}</em></div>
                </li>
                <li>
                    <div class="zmxj_left">支付宝</div>
                    <div class="zmxj_right">￥<em>${statistic.alipayTotal}</em></div>
                </li>
            </ul>
        </div>
    </div>

    <!-- 其他支付方式 end -->
    <!-- 游戏币 -->
    <div class="zmxq_qitafs zmxq_yxb">
        <div class="zmqitaf_inner">
            <ul>
                <li>
                    <div class="zmxj_left">游戏币</div>
                    <div class="zmxj_right"><em>${statistic.gameCoinQuantity}</em></div>
                </li>
                <li>
                    <div class="zmxj_left">出币</div>
                    <div class="zmxj_right"><em>${statistic.outGameCoinQuantity}</em></div>
                </li>
                <li>
                    <div class="zmxj_left">远程补币</div>
                    <div class="zmxj_right"><em>${statistic.remotelyOutGameCoinQuantity}</em></div>
                </li>
                <li>
                    <div class="zmxj_left">出礼品</div>
                    <div class="zmxj_right"><em>${statistic.giftSellQuantity}</em></div>
                </li>
            </ul>
        </div>
    </div>
    <!-- 游戏币 end-->
</div>

<!-- footer -->
<div class="zmxq_footer">
    <a href="javascript:void(0);" class='cur'>按日期</a>
    <a id="GC_device_frequency_account" href="javascript:void(0);">按次数</a>
</div>
<!-- footer end -->

<!-- 日期弹窗 -->
<%-- <div class="zmrq_pop ty_pop">
    <div class="popbg"></div>
    <div class="zmrq_inner">
        <i></i>
        <ul id="GC_device_account_querydate_ul">
           &lt;%&ndash;<li><a href="#">2016年9月28号</a></li>
            <li><a href="#">2016年9月27号</a></li>
            <li><a href="#">2016年9月26号</a></li>
            <li><a href="#">2016年9月25号</a></li>
            <li><a href="#">2016年9月24号</a></li>&ndash;%&gt;
        </ul>
    </div>
</div>--%>
<!-- 日期弹窗 end -->
</body>
</html>
<script>

    var url_prefix = '${basePath}wechat/income/accounts/${placeid}/';
    var url_param = "?placeName=" + encodeURI(encodeURI('${statistic.placeName}')) + "&deviceSerial=" + ${statistic.deviceid} +"&deviceName=" + encodeURI(encodeURI('${statistic.deviceName}'));

    /*按次数查询账目*/
    $("#GC_device_frequency_account").click(function () {
        window.location.href = url_prefix + 'frequencyaccount' + url_param;
    });

    /*当天流水账*/
    $("#GC_device_thatday_details").click(function () {
        window.location.href = url_prefix + 'thatdaydetails' + url_param + '&queryDate=' + encodeURI(encodeURI('${statistic.statisticDate}')) ;
    });

    /*当天流水账*/

    $("#GC_device_querydates").change(function(){
       // alert($(this).val());
        var url = url_prefix + 'thatdayaccount' + url_param + '&statisticDate=' + encodeURI(encodeURI($(this).val()));
        window.location.href = url;


    });

  /*  function aa(){
        $("#GC_device_account_querydate_ul").children('li').remove();
        $.ajax({
            url: url_prefix + 'accountdates',
            type: 'GET',
            data: {"deviceSerial": ${statistic.deviceid}},
            error: function (response) {
                ViewHelper.func.ajaxWechatErrorMessage(response);
            },
            success: function (ret) {
                if (ret.result) {

                    var current_date = "${statistic.statisticDate}";

                    $.each(ret.rows, function (index, item) {
                        /!*console.log(item.deviceid);
                         console.log(item.statisticid);
                         console.log(item.placeid);
                         console.log(item.userid);
                         console.log(item.queryDate);*!/

                        var dateStrs = item.queryDate;
                        var url = url_prefix + 'thatdayaccount' + url_param + '&statisticDate=' + encodeURI(encodeURI(dateStrs));
                        if (current_date != dateStrs) {
                            var newDateStrs = dateStrs.substring(0, 4) + "年" + dateStrs.substring(5, 7) + "月" + dateStrs.substring(8, dateStrs.length) + "日";
                            $("#GC_device_account_querydate_ul").append('<li><a id="' + item.statisticid + '" href="' + url + '">' + newDateStrs + '</a></li>');
                        }

                    });
                } else {
                    alert(ret.info)
                }
            }
        });
    };*/

</script>